<template>
  <div class="tranFromin">
    <form v-on:submit="submitFrom" v-on:keycode.enter="submitFrom">
      <input type="text" v-model="inputText" placeholder="输入需要翻译的内容">
      <select v-model="language">
        <option value="en">English</option>
        <option value="mr">Arabic</option>
      </select>
      <input type="submit" value="翻译">
    </form>
  </div>
</template>

<script>
export default {
  name: 'tranFromin',
  data: function () {
    return {
      inputText: '',
      language: '',
      newInputText: ''
    }
  },
  created: function () {
    this.language = 'en'
  },
  methods: {
    submitFrom (e) {
      if (this.inputText !== '') {
        this.$emit('formSubmit', this.inputText, this.language)
      }
      e.preventDefault()
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
